// settings.js
import request from '@/utils/request'

/**
 * 用户管理相关API
 */
export const getUserList = () => request({
    url: '/api/user',
    method: 'get'
})

export const createUser = (data) => request({
    url: '/api/user/create',
    method: 'post',
    data
})

export const updateUser = (data) => request({
    url: '/api/user',
    method: 'put',
    data
})

export const deleteUser = (id) => request({
    url: `/api/user/${id}`,
    method: 'delete'
})

export const getUserById = (id) => request({
    url: `/api/user/${id}`,
    method: 'get'
})

/**
 * 港口管理相关API
 */
export const getPortList = () => request({
    url: '/api/port',
    method: 'get'
})

export const createPort = (data) => request({
    url: '/api/port',
    method: 'post',
    data
})

export const updatePort = (data) => request({
    url: '/api/port',
    method: 'put',
    data
})

export const deletePort = (id) => request({
    url: `/api/port/${id}`,
    method: 'delete'
})

/**
 * 公司管理相关API
 */
export const getCompanyList = () => request({
    url: '/api/company',
    method: 'get'
})

export const createCompany = (data) => request({
    url: '/api/company',
    method: 'post',
    data
})

export const updateCompany = (data) => request({
    url: '/api/company',
    method: 'put',
    data
})

export const deleteCompany = (id) => request({
    url: `/api/company/${id}`,
    method: 'delete'
})

/**
 * 仓库管理相关API
 */
export const getWarehouseList = () => request({
    url: '/api/warehouse',
    method: 'get'
})

export const createWarehouse = (data) => request({
    url: '/api/warehouse',
    method: 'post',
    data
})

export const updateWarehouse = (data) => request({
    url: '/api/warehouse',
    method: 'put',
    data
})

export const deleteWarehouse = (id) => request({
    url: `/api/warehouse/${id}`,
    method: 'delete'
})